<?php
class Admin_Model_Viewlog extends Zend_Db_Table_Abstract
{
	public function viewlogall()
	{
		$db = Zend_Registry::get('connectDB');
		$data = $db->fetchAll($db->select()->from('systemlog')->joinInner('users','users.id_user=systemlog.id_user')->joinInner('groups','groups.id_group=users.id_group'));
		return $data;
	}
	public function search($content)
	{
		$db = Zend_Registry::get('connectDB');
		$where = $db->quoteInto('username LIKE ? OR ip_address LIKE ? OR name_group LIKE ?','%'.$content.'%');
		$data = $db->fetchAll($db->select()->from('systemlog')->joinInner('users','users.id_user=systemlog.id_user')->joinInner('groups','groups.id_group=users.id_group')->where($where));
		return $data;
	}
	public function delete($id)
	{
		$db = Zend_Registry::get('connectDB');
		$where = $db->quoteInto('id_log = ?',$id);
		$delete = $db->delete('systemlog',$where);
		return $delete;
	}
	public function deleteall($id)
	{
		$db = Zend_Registry::get('connectDB');
		$where= $db->quoteInto('id_log=?',$id);
		//}
		$delete = $db->delete('systemlog',$where);
		return $delete;
	}
}